package com.like.banzipao.server.model

import com.fasterxml.jackson.annotation.JsonIgnore

data class Player(val user: User) {
    var state: PlayerState = PlayerState.IDLE
    var integral: Int = 100

    // 积分改变。即本局积分输赢
    var integralChange: Int = 0

    // 用于前端显示朋友关系
    var friendType = FriendType.NONE

    // 用于没有出现友方时缓存朋友关系
    @get:JsonIgnore
    var friendTypeTemp = FriendType.NONE

    // 完成顺序。1：上游；2：中游；3：下游
    var completedOrder = CompletedOrder.NONE

    // 喊的友方
    var hanPoker: Poker? = null

    // 是否在线
    var online = false

    fun reset() {
        state = PlayerState.IDLE
        friendType = FriendType.NONE
        friendTypeTemp = FriendType.NONE
        completedOrder = CompletedOrder.NONE
        hanPoker = null
        integralChange = 0
    }
}

/**
 * 完成顺序
 */
enum class CompletedOrder(val des: String) {
    NONE("无名次"), ONE("第一名"), TWO("第二名"), THREE("第三名"), FOUR("第四名")
}

/**
 * 朋友关系
 */
enum class FriendType(val des: String) {
    NONE("没关系"), BAO("爆牌者"), FAN_BAO("反爆者"), OTHER("没有爆牌的人"), PARTY_A("甲方"), PARTY_B("乙方")
}

/**
 * 玩家状态
 */
enum class PlayerState(val des: String) {
    IDLE("空闲"),// 刚刚进入房间，未点击准备按钮
    READY("准备"),// 点击了准备按钮
    BAOING("爆牌中"),
    BAO("爆牌爆了"),
    BAO_PASS("不爆"),
    BAO_TURN("等待爆牌"),
    FAN_BAO_PASS("不反爆"),
    FAN_BAO_TURN("等待反爆"),
    DRAWING("换牌中"),
    DRAW_PLAYED("弃牌"),
    DRAW_TURN("等待换牌"),// 换牌轮子到了
    FIND_FRIEND("喊牌"),
    PLAYING("玩牌中"),// 正在玩牌
    PLAY_TURN("等待出牌"),// 出牌轮子到了
    PLAY_TURN_WIN("赢牌后等待出牌"),// 出牌轮子到了
    PLAY_PASS("不出"),
    PLAY_PLAYED("已出"),
    PLAY_WIN("赢"),
    PLAY_LOSE("输"),
}